home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-08-01 | 2.7 KB | 64 lines | [TEXT/ToyS] |
- -----------------------------------------------------------------------
- -- StarNine Technologies, Inc., hereby disclaims all copyright interest
- -- in the following source code.
- --
- -- This source code is free and has been placed into the public domain.
- -- You can redistribute it, modify it (including these comments) and/or
- -- create derivative works from it as you see fit.
- --
- -- This source code is made available in the hope that it will be useful,
- -- but WITHOUT ANY WARRANTY; without even the implied warranty of
- -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- -----------------------------------------------------------------------
-
- (* UNCOMMENT FOR TESTING *)
- --property s9MailFileName : "test message"
- (* END TESTING SECTION *)
-
- property trigger_succeeds : 1
- property trigger_fails : 0
- property trigger_error : -1
-
- property spool_folder : ""
-
- try
- tell application "Finder"
- if (exists of item spool_folder) is false then --see if stored property is valid
- if exists of item ((startup disk as string) & "ListSTAR/SMTP:ListSTAR Server") then
- copy (startup disk as string) & "ListSTAR/SMTP:Message Spool/SMTP:" to spool_folder
- else if exists of item ((startup disk as string) & "ListSTAR/MS:ListSTAR Server") then
- copy (startup disk as string) & "ListSTAR/MS:Message Spool/MS:" to spool_folder
- else if exists of item ((startup disk as string) & "ListSTAR/POP:ListSTAR Server") then
- copy (startup disk as string) & "ListSTAR/POP:Message Spool/POP:" to spool_folder
- else if exists of item ((startup disk as string) & "ListSTAR/QM:ListSTAR Server") then
- copy (startup disk as string) & "ListSTAR/QM:Message Spool/QM:" to spool_folder
- else
- error "The Spool Folder could not be found." number 100
- end if
- end if
- if (exists of file (spool_folder & s9MailFileName)) is false then --check spool file
- error "There is a problem with the spool file." number 101
- end if
- set theFile to open for access file (spool_folder & s9MailFileName) --open file for reading
- set theLine to "Start" --initialize theLine
- repeat while (the first character of theLine) is not return
- set theLine to read theFile until return --read in one line
- ignoring case
- if theLine contains "Precedence: Bulk" then
- close access theFile
- return trigger_succeeds
- end if
- end ignoring
- end repeat
- close access theFile
- end tell
- return trigger_fails
- on error errMsg number errNum
- close access theFile
- if errNum is not -39 then --check for end of file
- display dialog (errMsg & return & errNum) buttons {"Cancel"} default button "Cancel" with icon stop
- return trigger_error
- else --reached end of file
- return trigger_fails
- end if
- end try